home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / spinning-globe.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  4.0 KB  |  111 lines

  1. ;
  2. ; anim_sphere
  3. ;
  4. ;
  5. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  6. ; At ECS Dept, University of Southampton, England.
  7. ; This program is free software: you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 3 of the License, or
  10. ; (at your option) any later version.
  11. ;
  12. ; This program is distributed in the hope that it will be useful,
  13. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ; GNU General Public License for more details.
  16. ;
  17. ; You should have received a copy of the GNU General Public License
  18. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  19.  
  20.  
  21. ; Define the function:
  22.  
  23. (define (script-fu-spinning-globe inImage
  24.                                   inLayer
  25.                                   inFrames
  26.                                   inFromLeft
  27.                                   inTransparent
  28.                                   inIndex
  29.                                   inCopy)
  30.   (let* (
  31.         (theImage (if (= inCopy TRUE)
  32.                       (car (gimp-image-duplicate inImage))
  33.                       inImage))
  34.         (theLayer (car (gimp-image-get-active-layer theImage)))
  35.         (n 0)
  36.         (ang (* (/ 360 inFrames)
  37.                 (if (= inFromLeft TRUE) 1 -1) ))
  38.         (theFrame 0)
  39.         )
  40.  
  41.   (gimp-layer-add-alpha theLayer)
  42.  
  43.   (while (> inFrames n)
  44.     (set! n (+ n 1))
  45.     (set! theFrame (car (gimp-layer-copy theLayer FALSE)))
  46.     (gimp-image-add-layer theImage theFrame 0)
  47.     (gimp-drawable-set-name theFrame
  48.                          (string-append "Anim Frame: "
  49.                                         (number->string (- inFrames n) 10)
  50.                                         " (replace)"))
  51.     (plug-in-map-object RUN-NONINTERACTIVE
  52.                         theImage theFrame    ; mapping
  53.                         1                    ; viewpoint
  54.                         0.5 0.5 2.0          ; object pos
  55.                         0.5 0.5 0.0          ; first axis
  56.                         1.0 0.0 0.0          ; 2nd axis
  57.                         0.0 1.0 0.0          ; axis rotation
  58.                         0.0 (* n ang) 0.0    ; light (type, color)
  59.                         0 '(255 255 255)     ; light position
  60.                         -0.5 -0.5 2.0        ; light direction
  61.                         -1.0 -1.0 1.0  ; material (amb, diff, refl, spec, high)
  62.                         0.3 1.0 0.5 0.0 27.0 ; antialias
  63.                         TRUE                 ; tile
  64.                         FALSE                ; new image
  65.                         FALSE                ; transparency
  66.                         inTransparent        ; radius
  67.                         0.25                 ; unused parameters
  68.                         1.0 1.0 1.0 1.0
  69.                         -1 -1 -1 -1 -1 -1 -1 -1
  70.     )
  71.   )
  72.  
  73.   (gimp-image-remove-layer theImage theLayer)
  74.   (plug-in-autocrop RUN-NONINTERACTIVE theImage theFrame)
  75.  
  76.   (if (= inIndex 0)
  77.       ()
  78.       (gimp-image-convert-indexed theImage FS-DITHER MAKE-PALETTE inIndex
  79.                                   FALSE FALSE ""))
  80.  
  81.   (if (= inCopy TRUE)
  82.     (begin
  83.       (gimp-image-clean-all theImage)
  84.       (gimp-display-new theImage)
  85.     )
  86.   )
  87.  
  88.   (gimp-displays-flush)
  89.   )
  90. )
  91.  
  92. (script-fu-register
  93.   "script-fu-spinning-globe"
  94.   _"_Spinning Globe..."
  95.   _"Create an animation by mapping the current image onto a spinning sphere"
  96.   "Chris Gutteridge"
  97.   "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  98.   "16th April 1998"
  99.   "RGB* GRAY*"
  100.   SF-IMAGE       "The Image"               0
  101.   SF-DRAWABLE    "The Layer"               0
  102.   SF-ADJUSTMENT _"Frames"                  '(10 1 360 1 10 0 1)
  103.   SF-TOGGLE     _"Turn from left to right" FALSE
  104.   SF-TOGGLE     _"Transparent background"  TRUE
  105.   SF-ADJUSTMENT _"Index to n colors (0 = remain RGB)" '(63 0 256 1 10 0 1)
  106.   SF-TOGGLE     _"Work on copy"            TRUE
  107. )
  108.  
  109. (script-fu-menu-register "script-fu-spinning-globe"
  110.                          "<Image>/Filters/Animation/Animators")
  111.